<!---
 @Name: index.vue
 @Author: lhf
 @Owner:
 @Date: 2025-07-15 15:20:27
 @LastEditTime: 2025-07-15 15:20:27
 @LastEditors:lhf
 @Description:  医院信息
 @Version:
 @FilePath: src\views\column\index.vue
--->

<template>
  <div class="container">
    <div class="section-body" ref="conRef" v-html="content" />
  </div>
</template>

<script>
import { getProgramInfo } from '@/api';
export default {
  name: 'HelloWorld',
  props: {
    programId: String
  },
  components: {},
  data() {
    return {
      content: ''
    };
  },
  computed: {},
  mounted() {
    this.getProgramInfos();
    this.$nextTick(() => {
      const conRef = this.$refs.conRef;
      if (conRef) {
        conRef.addEventListener('click', (e) => {
          if (e.target.tagName === 'IMG') {
            const url = e.target.getAttribute('src');
            if (url) this.$AndroidSdk.ImageAction(url);
          }
          if (e.target.classList.contains('edui-box')) {
            const url = e.target.getAttribute('src');
            if (url) {
              const obj = {
                x: 0,
                y: 0,
                width: document.body.clientWidth,
                height: document.body.clientHeight,
                url: url
              };
              this.$AndroidSdk.PlayVideoAction(JSON.stringify(obj));
            }
          }
        });
      }
    });
  },
  methods: {
    getProgramInfos() {
      getProgramInfo({
        programId: this.programId
      }).then((res) => {
        if (res.status == 0) {
          const arr = res.data || [];
          if (arr.length > 0) {
            const { content } = arr[0];
            this.content = content;
          }
        }
      });
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
.container {
  height: 100%;
  background: #f2f6fc;
  border-radius: 20px;
  padding: 30px;
  .section-body {
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch; /* iOS 惯性滚动 */
    scroll-behavior: smooth; /* 平滑滚动 */
    line-height: 2;
    text-align: justify;
    word-break: break-word;
    font-size: 32px;
    :deep(p) {
      text-indent: 2em;
    }
    :deep(img) {
      width: 100%;
      margin: 0 auto;
      display: block;
      object-fit: contain;
    }
    :deep(.edui-box) {
      width: 800px;
      height: 400px;
      background: url('@/assets/images/bg-video.png') no-repeat center;
      background-size: cover;
      margin: 0 auto;
      video {
        visibility: hidden;
        display: block;
      }
    }
  }
}
</style>
